<template>
    <div>
        <div><input v-model="name"></div>
        <div><input v-model="password"></div>
        <p>{{ tip }}</p>
    </div>
</template>
<script>
import { ref, computed,watch } from "vue"
export default {
    setup() {
        const name = ref("");
        const password = ref("提示");
        //侦听器
        watch(password, (newValue, oldValue) => {
            //新值字符串长度小于6位，做提示
            if (newValue.length<6){
                tip.newValue="密码过程"
            }else{
                tip.value=""
            }
        })
        return {
            name,
            password,
            tip
        }
    }
            
 }
</script>